package com.turtle3d.turtle;

import java.util.ArrayList;

public class TurtlePosition
{
	
	private ArrayList<TurtleNode> branches = new ArrayList<TurtleNode>();	
	
	public TurtlePosition(){
		branches.add(new TurtleNode(0, "0"));
	}

	public String getPositionLabel(){
		return branches.get(branches.size()-1).branchLabel;
	}
	
	public void branchNew(){
		branches.add(new TurtleNode(0, getLast().branchLabel+"_"+(getLast().children++)));				
	}
	
	public void branchBack(){
		branches.remove(branches.size()-1);
	}
	
	private TurtleNode getLast(){
		return branches.get(branches.size()-1);
	}
	
}
